const USER_KEY = "user_key";

let user = {};

const setUser = user => {
  localStorage.setItem(USER_KEY, JSON.stringify(user));
};

const getUser = () => {
  return JSON.parse(localStorage.getItem(USER_KEY) || "{}");
};

const removeUser = () => {
  localStorage.removeItem(USER_KEY);
};

const localUtils = {
  user,
  setUser,
  getUser,
  removeUser
};

export default localUtils;
